import Vue from 'vue'
import VueRouter, { RouteConfig } from 'vue-router'
import Home from '../views/Home.vue'
import Register from '../components/Register.vue'
import Login from '../components/Login.vue'
import List from '../views/List.vue'
import AirplaneList from '../components/AirplaneList.vue'
import UserList from '../components/UserList.vue'
import TicketList from '../components/TicketList.vue'
import NotFound from '../components/NotFound.vue'


import { component } from 'vue/types/umd'

Vue.use(VueRouter)

const routes: Array<RouteConfig> = [
  {
    path: '/',
    name: 'Index',
    redirect: "/airplane",
  },
  { 
    path: '*', 
    name:"404",
    component: NotFound
  },
  {
    path: '/loginOut',
    name: 'Index',
    redirect: "/airplane",
  },
  {
    path: '/home',
    name: 'Home',
    component: Home,
    children: [
      {
        path: '/register',
        component: Register
      },
      {
        path: '/login',
        component: Login
      },
    ]
  },
  {
    path: '/list',
    name: 'List',
    component: List,
    children: [
      {
        path: '/airplane',
        component: AirplaneList
      },
      {
        path: '/user',
        component: UserList
      },
      {
        path: '/ticket',
        component: TicketList
      }
    ]
  }

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
